package com.cxd.app.constants;

import java.util.HashMap;
import java.util.Map;

import com.cxd.base.util.date.DateUtil;

/**
 * <一句话功能简述> <功能详细描述>
 * @author wtj
 * @date 2015年12月4日 下午3:47:13
 * @company CXD
 * @version [Copyright (c) 2015 V001]  
 */
public class PublicConstants {
	public static final String NEWER_BEGIN_TIME = "2015-11-20 12:00:00";// 新手专享计算期限
	public static final int NEWER_COUNT_LIMIT = 3 ;//# 新手专享次数限制
	
	

	
	public static Map<String,String> rechargeStatusMap = new HashMap<String,String>();
	static{
		rechargeStatusMap.put("success", "成功");
		rechargeStatusMap.put("fail", "失败");
		rechargeStatusMap.put("wait_pay", "等待支付");
	}
	public static Map<String,String> rechargeAdminMap = new HashMap<String,String>();
	static{
		rechargeAdminMap.put("1", "是");
		rechargeAdminMap.put("0", "否");
	}
	
	public static Map<String,String> sourceType = new HashMap<String,String>();
	static{
		sourceType.put("1", "是");
		sourceType.put("0", "否");
	}
	
	/**
	 * 用户性别类型
	 */
	public static Map<String,String> sexType = new HashMap<String,String>();
	static{
		sexType.put("M", "男");
		sexType.put("F", "女");
	}
	/**
	 * 投资状态
	 */
	public static Map<String,String> investStatusMap = new HashMap<String,String>(); 
	static{
		investStatusMap.put("wait_affirm", "第三方资金托管确认中");
		investStatusMap.put("bid_success", "投标成功");
		investStatusMap.put("cancel", "流标");
		investStatusMap.put("repaying", "还款中");
		investStatusMap.put("complete", "完成");
		investStatusMap.put("bad_debt", "坏账");
		investStatusMap.put("overdue", "逾期");
		investStatusMap.put("放款后等待第三方确认", "wait_loaning_verify");
	}
	public static Map<String,String> loanType = new HashMap<String,String>(); 
	static{
		loanType.put("loan_type_1", "先付利息后还本金，按天计息，即投即生息");
		loanType.put("loan_type_2", "等额本息，按月计息，按月还款，放款后生息");
		loanType.put("loan_type_3", "先付利息后还本金，按天计息，放款后生息");
		loanType.put("loan_type_4", "到期还本付息，按天计息，放款后生息");
		loanType.put("loan_type_5", "到期还本付息，按天计息，即投即生息");
	}
	public static Map<String,String> loanTimeType = new HashMap<String,String>(); 
	static{
		loanTimeType.put("loan_type_1", "月");
		loanTimeType.put("loan_type_2", "月");
		loanTimeType.put("loan_type_3", "月");
		loanTimeType.put("loan_type_4", "天");
		loanTimeType.put("loan_type_5", "天");
	}
	/**
	 * 资金操作类型
	 */
	public static Map<String,String> moneyOperationType = new HashMap<String,String>();
	static{
		moneyOperationType.put("cancel_invest","投资流标");
		moneyOperationType.put("投资成功","投资成功");
		moneyOperationType.put("invest_success","投资成功");
		moneyOperationType.put("提现成功","提现成功");
		moneyOperationType.put("transfer","转让债权");
		moneyOperationType.put("normal_repay","正常还款");
		moneyOperationType.put("cancel_loan","借款流标");
		moneyOperationType.put("转让债权","转让债权");
		moneyOperationType.put("recharge_success","充值成功");
		moneyOperationType.put("借款流标","借款流标");
		moneyOperationType.put("正常还款","正常还款");
		moneyOperationType.put("管理员干预","管理员干预");
		moneyOperationType.put("充值成功","充值成功");
		moneyOperationType.put("申请提现","申请提现");
		moneyOperationType.put("admin_operation","管理员干预");
		moneyOperationType.put("借款放款","借款放款");
		moneyOperationType.put("apply_withdraw","申请提现");
		moneyOperationType.put("give_money_to_borrower","借款放款");
		moneyOperationType.put("投资流标","投资流标");
		moneyOperationType.put("withdraw_success","提现成功");
		moneyOperationType.put("提现申请未通过","提现申请未通过");
		moneyOperationType.put("refuse_apply_withdraw","提现申请未通过");
		moneyOperationType.put("advance_repay","提前还款");
		moneyOperationType.put("overdue_repay","逾期还款");
		moneyOperationType.put("apply_loan","申请借款");
	}
	/**
	 * 用户账单类型
	 */
	public static Map<String,String> userBillType = new HashMap<String,String>();
	static{
		userBillType.put("freeze", "冻结");
		userBillType.put("unfreeze", "解冻");
		userBillType.put("to_balance", "从余额转出");
		userBillType.put("ti_balance", "转入到余额");
		userBillType.put("to_frozen", "从冻结金额中转出");
	}
	
	public static String getSourceTypeName(Object sourceType){
		if(sourceType == null){
			return "";
		}
		String sourceTypeName = "";
		if(sourceType.equals("0")){
			sourceTypeName = "PC";
		}else if(sourceType.equals("1")){
			sourceTypeName = "ANDROID";
		}else if(sourceType.equals("2")){
			sourceTypeName = "IOS";
		}else if(sourceType.equals("3")){
			sourceTypeName = "手机";
		}else if(sourceType.equals("4")){
			sourceTypeName = "H5-ANDROID";
		}else if(sourceType.equals("5")){
			sourceTypeName = "H5-IOS";
		}else if(sourceType.equals("6")){
			sourceTypeName = "H5-PC";
		}
		return sourceTypeName;
	}
	
	public static String getAge(Object birthday){
		if(birthday==null){
			return "";
		}
		return (Integer.parseInt(DateUtil.getYear())-Integer.parseInt(DateUtil.getYear(DateUtil.toDate(birthday.toString()))))+"";
	}
}
